package com.sky.controller.admin;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/category")
public class CategoryControler {
    @Autowired
    private CategoryService categoryService;
    @GetMapping("/list")

    public Result querylist(@RequestParam("type") Integer type) {
        List<Category> list = categoryService.list(type);
        if(list!=null&list.size()>0)
           return Result.success(list);
        else {
            return Result.error("查询失败");
        }
    }

}
